package com.buaa.divinationmaster.manager;

import com.buaa.divinationmaster.model.LenormandCard;
import java.util.ArrayList;
import java.util.List;

/**
 * 雷诺曼卡牌数据管理器
 * 管理36张经典雷诺曼卡牌的数据
 */
public class LenormandCardManager {
    
    private static LenormandCardManager instance;
    private List<LenormandCard> allCards;
    
    private LenormandCardManager() {
        initializeCards();
    }
    
    public static synchronized LenormandCardManager getInstance() {
        if (instance == null) {
            instance = new LenormandCardManager();
        }
        return instance;
    }
    
    /**
     * 初始化36张雷诺曼卡牌数据
     */
    private void initializeCards() {
        allCards = new ArrayList<>();
        
        // 1-10
        allCards.add(new LenormandCard(1, "骑手", "🏇", "消息,快速,行动", 
            "新消息或机会即将到来，需要快速行动", "新恋情或重要消息", "工作机会或紧急任务", "需要快速治疗", "很快，几天内", "火", "lenormand_01_rider.jpg"));
            
        allCards.add(new LenormandCard(2, "三叶草", "🍀", "幸运,机会,希望", 
            "小幸运和正面的惊喜", "甜蜜的爱情时光", "小的成功或机会", "恢复和好转", "短期内", "土", "lenormand_02_clover.jpg"));
            
        allCards.add(new LenormandCard(3, "船", "⛵", "旅行,进展,向前", 
            "旅行或人生的进展", "异地恋或旅行中的爱情", "事业发展或出差", "需要改变生活方式", "中期，几周到几月", "水", "lenormand_03_ship.jpg"));
            
        allCards.add(new LenormandCard(4, "房子", "🏠", "家庭,安全,传统", 
            "家庭、安全感和稳定", "稳定的关系或家庭", "稳定的工作环境", "健康稳定", "长期稳定", "土", "lenormand_04_house.jpg"));
            
        allCards.add(new LenormandCard(5, "树", "🌳", "健康,生长,根基", 
            "健康、成长和深层根基", "深入发展的关系", "稳步发展的事业", "整体健康状况", "缓慢但持续", "土", "lenormand_05_tree.jpg"));
            
        allCards.add(new LenormandCard(6, "云", "☁️", "困惑,暂时困难,模糊", 
            "暂时的困难或困惑", "关系中的误解", "工作中的不确定", "小病或不适", "短暂困难期", "空", "lenormand_06_clouds.jpg"));
            
        allCards.add(new LenormandCard(7, "蛇", "🐍", "欺骗,复杂,诱惑", 
            "复杂情况或欺骗", "三角恋或背叛", "职场政治或竞争", "慢性疾病", "复杂的时期", "土", "lenormand_07_snake.jpg"));
            
        allCards.add(new LenormandCard(8, "棺材", "⚰️", "结束,转变,哀伤", 
            "结束和转变", "关系的结束", "工作的变化", "需要休息恢复", "结束阶段", "土", "lenormand_08_coffin.jpg"));
            
        allCards.add(new LenormandCard(9, "花束", "💐", "礼物,邀请,社交", 
            "礼物、邀请和社交活动", "浪漫的礼物", "工作认可或邀请", "身心愉悦", "近期社交活动", "空", "lenormand_09_bouquet.jpg"));
            
        allCards.add(new LenormandCard(10, "镰刀", "🗡️", "突然变化,结束,收获", 
            "突然的变化或结束", "突然的分手", "突然的工作变化", "需要手术", "突然发生", "金", "lenormand_10_scythe.jpg"));
        
        // 11-20
        allCards.add(new LenormandCard(11, "鞭子", "🔗", "争吵,讨论,重复", 
            "争吵、讨论或重复的模式", "关系中的争执", "工作压力或争议", "重复性疾病", "重复发生", "火", "lenormand_11_whip.jpg"));
            
        allCards.add(new LenormandCard(12, "鸟", "🕊️", "沟通,谈话,紧张", 
            "沟通、谈话或紧张情绪", "重要对话", "商务谈判", "神经紧张", "很快会有消息", "空", "lenormand_12_birds.jpg"));
            
        allCards.add(new LenormandCard(13, "孩子", "👶", "新开始,天真,小事", 
            "新的开始或小事情", "新恋情或怀孕", "新项目开始", "生育相关", "新的开始", "水", "lenormand_13_child.jpg"));
            
        allCards.add(new LenormandCard(14, "狐狸", "🦊", "狡猾,工作,独立", 
            "狡猾、工作相关或独立", "需要谨慎的关系", "工作技巧或警惕", "需要预防", "需要小心时期", "火", "lenormand_14_fox.jpg"));
            
        allCards.add(new LenormandCard(15, "熊", "🐻", "力量,保护,母性", 
            "力量、保护和母性力量", "保护性的爱", "有影响力的人", "强壮体质", "持续的力量", "土", "lenormand_15_bear.jpg"));
            
        allCards.add(new LenormandCard(16, "星星", "⭐", "希望,愿望,指引", 
            "希望、愿望和精神指引", "美好的愿望", "梦想职业", "康复和希望", "愿望实现期", "空", "lenormand_16_stars.jpg"));
            
        allCards.add(new LenormandCard(17, "鹳", "🦢", "变化,搬家,怀孕", 
            "积极的变化或搬迁", "关系进展", "工作变动", "生育健康", "变化期", "水", "lenormand_17_stork.jpg"));
            
        allCards.add(new LenormandCard(18, "狗", "🐕", "忠诚,友谊,可靠", 
            "忠诚、友谊和可靠", "忠实的伴侣", "可靠的同事", "稳定健康", "持久关系", "土", "lenormand_18_dog.jpg"));
            
        allCards.add(new LenormandCard(19, "塔", "🗼", "权威,隔离,官方", 
            "权威、隔离或官方事务", "权威人物影响", "官方工作", "需要独处恢复", "权威决定期", "土", "lenormand_19_tower.jpg"));
            
        allCards.add(new LenormandCard(20, "花园", "🌺", "社交,公众,庆祝", 
            "社交活动和公众场合", "公开的关系", "团队工作", "社交健康", "社交活跃期", "空", "lenormand_20_garden.jpg"));
        
        // 21-30
        allCards.add(new LenormandCard(21, "山", "⛰️", "障碍,挑战,延迟", 
            "障碍、挑战或延迟", "关系障碍", "工作挑战", "健康问题", "需要耐心", "土", "lenormand_21_mountain.jpg"));
            
        allCards.add(new LenormandCard(22, "路", "🛤️", "选择,决定,方向", 
            "选择、决定或方向", "关系选择", "职业道路", "治疗方案", "决定时刻", "土", "lenormand_22_crossroad.jpg"));
            
        allCards.add(new LenormandCard(23, "老鼠", "🐭", "损失,压力,减少", 
            "逐渐的损失或压力", "关系磨损", "资源减少", "体力消耗", "逐渐损失期", "土", "lenormand_23_mice.jpg"));
            
        allCards.add(new LenormandCard(24, "心", "❤️", "爱情,情感,快乐", 
            "爱情、深层情感和快乐", "真爱和幸福", "热爱的工作", "心脏健康", "爱情时期", "火", "lenormand_24_heart.jpg"));
            
        allCards.add(new LenormandCard(25, "戒指", "💍", "承诺,合同,循环", 
            "承诺、合同或循环", "订婚结婚", "签约合作", "治疗周期", "承诺期", "金", "lenormand_25_ring.jpg"));
            
        allCards.add(new LenormandCard(26, "书", "📚", "秘密,学习,知识", 
            "秘密、学习或隐藏知识", "隐秘的关系", "学习新技能", "诊断结果", "学习期", "水", "lenormand_26_book.jpg"));
            
        allCards.add(new LenormandCard(27, "信", "✉️", "消息,文件,新闻", 
            "重要消息或文件", "情书或消息", "工作文件", "医疗报告", "消息到达", "空", "lenormand_27_letter.jpg"));
            
        allCards.add(new LenormandCard(28, "男人", "👨", "男性,行动,理性", 
            "重要男性或阳性能量", "男性伴侣", "男性同事", "男性医生", "男性影响期", "火", "lenormand_28_man.jpg"));
            
        allCards.add(new LenormandCard(29, "女人", "👩", "女性,直觉,感性", 
            "重要女性或阴性能量", "女性伴侣", "女性同事", "女性医生", "女性影响期", "水", "lenormand_29_woman.jpg"));
            
        allCards.add(new LenormandCard(30, "百合", "🌸", "和平,性,成熟", 
            "和平、性或成熟", "成熟的爱情", "和谐工作", "性健康", "和平时期", "水", "lenormand_30_lily.jpg"));
        
        // 31-36
        allCards.add(new LenormandCard(31, "太阳", "☀️", "成功,快乐,胜利", 
            "成功、快乐和胜利", "幸福关系", "事业成功", "强壮健康", "成功时期", "火", "lenormand_31_sun.jpg"));
            
        allCards.add(new LenormandCard(32, "月亮", "🌙", "名声,周期,幻想", 
            "名声、周期性或幻想", "浪漫幻想", "创意工作", "情绪健康", "周期性变化", "水", "lenormand_32_moon.jpg"));
            
        allCards.add(new LenormandCard(33, "钥匙", "🗝️", "解决,重要,开启", 
            "解决方案和重要发现", "关系突破", "重要机会", "治疗关键", "突破时刻", "金", "lenormand_33_key.jpg"));
            
        allCards.add(new LenormandCard(34, "鱼", "🐟", "财富,独立,灵性", 
            "财富、独立或灵性", "经济独立", "财务成功", "营养健康", "财运期", "水", "lenormand_34_fish.jpg"));
            
        allCards.add(new LenormandCard(35, "锚", "⚓", "稳定,安全,持久", 
            "稳定、安全和持久性", "稳定关系", "安全工作", "稳定健康", "长期稳定", "水", "lenormand_35_anchor.jpg"));
            
        allCards.add(new LenormandCard(36, "十字", "✝️", "负担,命运,牺牲", 
            "负担、命运或必要牺牲", "关系考验", "工作责任", "健康挑战", "考验期", "土", "lenormand_36_cross.jpg"));
    }
    
    /**
     * 获取所有卡牌
     */
    public List<LenormandCard> getAllCards() {
        return new ArrayList<>(allCards);
    }
    
    /**
     * 根据ID获取卡牌
     */
    public LenormandCard getCardById(int id) {
        for (LenormandCard card : allCards) {
            if (card.getId() == id) {
                return card;
            }
        }
        return null;
    }
    
    /**
     * 获取洗牌后的卡牌列表
     */
    public List<LenormandCard> getShuffledCards() {
        List<LenormandCard> shuffled = new ArrayList<>(allCards);
        java.util.Collections.shuffle(shuffled);
        return shuffled;
    }
    
    /**
     * 抽取指定数量的卡牌
     */
    public List<LenormandCard> drawCards(int count) {
        List<LenormandCard> shuffled = getShuffledCards();
        return shuffled.subList(0, Math.min(count, shuffled.size()));
    }
}
